package com.zyt.service.impl;

import com.zyt.dao.UserMapper;
import com.zyt.pojo.User;
import com.zyt.util.MyBitisUtil;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.session.SqlSession;

public class UserSericeImpl implements com.zyt.service.UserSerice {
    @Override
    public User selectNameAndPassword(String name, String password) {
        SqlSession sqlSession= null;
        User user =null;
        try {
            sqlSession= MyBitisUtil.getSession();
            UserMapper userMapper =sqlSession.getMapper(UserMapper.class);
            user= userMapper.selectNameAndPassword(name,password);
            sqlSession.commit();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            MyBitisUtil.closeSession(sqlSession);
        }
        return user;
    }
}
